package com.txf.simple.ui.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.aspsine.swipetoloadlayout.SwipeLoadMoreTrigger;
import com.aspsine.swipetoloadlayout.SwipeTrigger;
import com.txf.simple.R;

/**
 * @author txf
 * @Title 自定义上拉加载View
 * @package com.txf.simple.ui.view
 * @date 2016/11/24 0024
 */

public class SwipeLoadView extends RelativeLayout implements SwipeLoadMoreTrigger,SwipeTrigger {
    private TextView contentTv;
    private ProgressBar progressBar;
    public SwipeLoadView(Context context) {
        super(context);
        init();
    }
    public SwipeLoadView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }
    public SwipeLoadView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }
    private void init() {
    }
    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        LayoutInflater.from(getContext()).inflate(R.layout.view_swipe_load_layout, this);
        contentTv = (TextView) findViewById(R.id.contentTv);
        progressBar = (ProgressBar) findViewById(R.id.progressBar);
    }
    @Override
    public void onLoadMore() {
    }
    @Override
    public void onPrepare() {

    }
    @Override
    public void onMove(int i, boolean b, boolean b1) {
        progressBar.setVisibility(VISIBLE);
        contentTv.setText("加载中");
    }
    @Override
    public void onRelease() {

    }
    @Override
    public void onComplete() {
        progressBar.setVisibility(INVISIBLE);
        contentTv.setText("加载完成");

    }
    @Override
    public void onReset() {
    }
}
